package com.yanqu.road.server.manger.config.grandchild.talent.condition;

import com.yanqu.road.server.manger.config.grandchild.talent.entity.TalentConditionParam;
import com.yanqu.road.server.manger.config.grandchild.talent.entity.TalentConditionResult;
import com.yanqu.road.server.manger.config.grandchild.talent.entity.TalentConditionResultBuilder;

public class TalentConditionTAA implements ITalentCondition {

    @Override
    public TalentConditionResult getResult(TalentConditionParam param) {
        // 取值
        int value1 = param.getGrandChild().getFlairList().stream().mapToInt(Integer::intValue).sum();
        int value2 = param.getCondition().getValue();

        // 比较
        boolean result = param.getCondition().getFlag().getResult(value1, value2);

        return TalentConditionResultBuilder.aTalentConditionResult().setCanRandom(result).build();
    }

}
